import { defineEventHandler } from "h3";
import axios from "axios";

const getBlogAuthorProfile = async (token: string) => {
  const response = await axios.get("https://gitee.com/api/v5/user", {
    params: {
      access_token: token,
    },
  });
  return response.data;
};

export default defineEventHandler(async (event) => {
  const runtimeConfig = useRuntimeConfig();
  return await getBlogAuthorProfile(runtimeConfig.giteeToken);
});
